{include file="./headStart.tpl"}
{literal}
<script type="text/javascript">
$(document).ready(function(){
  $(".add").click(function(){ 
    $("#one").clone(true).appendTo("#mainDiv").find('input[type="text"]').val('');    
    addRow();
  });
$("#insertBtn").click(function(event){
	var data1 = $(".partyId").val();
	var data2 = $(".categoryId").val();
    if(data1 == 0)
    {
      alert("Select Customer");
      $(".partyId").focus();
      return false;
    }
     if(data2 == 0)
    {
      alert("Select System");
      $(".categoryId").focus();
      return false;
    }
  });  
});
function deleteRow() 
{
  $('.delete').click(function()
  {
    var countSr = 1;
    $(this).parent().parent().remove();
    $('.srNoClass').each(function(){
          this.value = countSr++;
        });
    return false;
  });
}
function addRow() 
{
  var countSr = 1;
    $('.srNoClass').each(function()
    {
      this.value = countSr++;
    });
    return false;
}
</script>
{/literal}
{include file="./headEnd.tpl"}
<form name="form" action="{$smarty.server.PHP_SELF}" id="form" method="post">
<input type="hidden" name="newinstallationMasterId" value="{$newinstallationMasterId}" />
<input type="hidden" name="isEdit" value="{$isEdit}" /> 
<input type="hidden" name="newInstallComplete" value="{$newInstallComplete}" /> 
<input type="hidden" name="newInstallInComplete" id="newInstallInComplete" value="{$newInstallInComplete}" />
<center class="center" ><h2>ED Systems</h2></center>
<table align="center" border="1" cellpadding="2" cellspacing="1">
  <tr>
    <td align="center" class="table1" colspan="6">New Installation Entry</td>
  </tr>
  <tr>
    <td align="left" class="table2" NOWRAP>Customer <font color="red"> *</font> : </td>
    <td class="table2"  NOWRAP>
    	{if $newInstallComplete == 1}
        <select name="partyId" id="partyId" disabled="disabled">
      {else}
      	<select name="partyId" id="partyId" class="partyId">
      {/if}
        <option value="0">Customer Name</option>
        {html_options values=$partyId output=$companyName selected=$companyNameSelected} 
      </select>
      <a href="party.php?redirectFrom=newInstallation" class="link">New Customer</a>  
    </td>
    <td align="left" class="table2"  NOWRAP>Date : </td>
    <td NOWRAP class="table2" NOWRAP>
    	{if $newInstallComplete == 1}
        {html_select_date prefix="insertDate" time="$insertDateSelected" start_year="-3" end_year="+1" month_format="%m" 
         field_order="DMY" day_value_format="%02d" day_extra='disabled=disabled' month_extra='disabled=disabled' year_extra='disabled=disabled'}
      {else}
        {html_select_date prefix="insertDate" time="$insertDateSelected" start_year="-3" end_year="+1" month_format="%m" 
        field_order="DMY" day_value_format="%02d"}
      {/if}
    </td>
    <td align="left" class="table2"  NOWRAP>Targeted Date : </td>
    <td NOWRAP class="table2">
    	{if $newInstallComplete == 1}
        {html_select_date prefix="targetDate" time="$targetDateSelected" start_year="-3" end_year="+1" month_format="%m" 
         field_order="DMY" day_value_format="%02d" day_extra='disabled=disabled' month_extra='disabled=disabled' year_extra='disabled=disabled'}
      {else}
        {html_select_date prefix="targetDate" time="$targetDateSelected" start_year="-3" end_year="+1" month_format="%m" 
        field_order="DMY" day_value_format="%02d"}
      {/if}
    </td>
  </tr>
  <tr>
  </tr>
</table>
<table align="center" border="1" cellpadding="2" cellspacing="1" >
  <tr>
  	{if $newInstallComplete != 1}
    <td align="center" class="table1">Sr. No.</td>
    {/if}
    {if $newInstallComplete == 1}  
      <td align="center" class="table1">Category</td>
      {if $newInstallInComplete != 1}
      {/if}  
      <td align="center" class="table1">Description</td>
    {else}
      <td align="center" class="table1">Item Category</td>
      <td align="center" class="table1">Description</td>
      <td align="center" class="table1">&nbsp;</td>
      <td align="center" class="table1">&nbsp;</td>
  {/if}
  </tr>
  {if $newInstallComplete == 1}
  {section name="sec" loop=$newInstallationArray}
    <tbody id="mainDiv">  
    <tr id="one">
        <td class="table2" align="center">{$newInstallationArray[sec].categoryName}</td>
        <td size=5 class="table2"><textarea Name="description[]" Rows="10" Cols="16"  disabled="disabled">{$newInstallationArray[sec].description}</textarea></td>
    </tr>
    </tbody>
  {/section}
  {else}
    {if $newInstallInComplete == 1 || $isEdit == 1}
        <tbody id="mainDiv">  
        {section name="sec" loop=$newInstallationArray}
          <tr id="one">
            <td class="table2"><input type="text" class="srNoClass" name="srNo[]" id="srNo[]" value="1" size="5" DISABLED /></td>
            <td class="table2" NOWRAP>
            <select name="categoryId[]" id="categoryId[]" class="classSubcategory categoryId">
              <option value="0">Select Category </option>
              {html_options values=$categoryArray.categoryId output=$categoryArray.categoryName selected=$newInstallationArray[sec].categoryId}
            </select>
            </td>
            <td size=5 class="table2"><textarea Name="description[]" Rows="1" Cols="16">{$newInstallationArray[sec].description}</textarea></td>
            <td class="table2"><input type="button" value="Add" name="add" class="add"/></td>
            <td class="table2"><input type="button" value="Delete" name="deleteBtn"  class="delete" onclick="deleteRow()"/></td>
          </tr>
        {/section}
        </tbody>
    {else}
      <tbody id="mainDiv">  
      <tr id="one">
        <td class="table2"><input type="text" class="srNoClass" name="srNo[]" id="srNo[]" value="1" size="5" DISABLED /></td>
        <td class="table2" NOWRAP>
        <select name="categoryId[]" id="categoryId[]" class="classSubcategory categoryId">
          <option value="0">Select Category </option>
          {html_options values=$categoryArray.categoryId output=$categoryArray.categoryName}
        </select>
        </td>
        <td size=5 class="table2"><textarea Name="description[]" Rows="2" Cols="50" required></textarea></td>
        <td class="table2"><input type="button" value="Add" name="add" class="add"/></td>
        <td class="table2"><input type="button" value="Delete" name="deleteBtn"  class="delete" onclick="deleteRow()"/></td>
      </tr>
      </tbody>
    {/if}
  {/if}
</table>
<table border="1" align="center">
	<tr>
	  <td align="center" class="table1">Customer Feedback</td>
    <td align="center" class="table1">Customer Signature</td>
  </tr>
  <tr>
	  <td align="center" class="table1"><textarea name="marketFeedback" rows="3" cols="55"></textarea></td>
    <td class="table2">______________________</td>
  </tr>
</table>
<table align="center">
  <tr>
    <td align="center" colspan="8" class="table2"><input class="button" type="submit" name="insertBtn" id="insertBtn" value="Submit" class="insertBtn" />
      {if $isEdit == 1 || $newInstallComplete == 1 || $newInstallInComplete == 1}
	      <a href="serviceList.php" class="link">Cancel</a>
	    {else}
	      <input class="button" type="submit" name="printBtn" id="printBtn" value="Print"/>
	    {/if}
    </td>
  </tr>
</table>
</form>
{include file="footer.tpl"}